package mysql;

import java.sql.SQLException;
import java.util.Random;

public class QueryTest {
	
	private static final Random randomGenerator = new Random();
	
	public static void testQuery(int numTests) throws SQLException{
		DB db = new DB("jdbc:mysql://localhost/mysql_db", "root", "password");
		
		
		for(int i = 0; i < numTests; i++){
			int minAge = randomGenerator.nextInt(80);
			long start = System.nanoTime();
			int size = db.getNumAgeRange(minAge, minAge + 20);
			long elapsedTime = System.nanoTime() - start;
			System.out.println("Age query [" + minAge +", " + minAge + 20 + "] " + size + " " + elapsedTime);
		}

	}
	
	
	
	public static void main(String[] args) throws SQLException {
		QueryTest.testQuery(100);
	}
}
